package com.hdjk.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.hdjk.view.R;

/**
 * Created by sxy on 2017/11/14.
 */

public class MyAlertDialog extends Dialog {
    private Context mContext;
    private String mTitle;
    private View.OnClickListener mOnSureClick;
    private TextView dialog_content,tv_sure;

    public MyAlertDialog(@NonNull Context context, String title, View.OnClickListener onClickListener) {
        super(context);
        mContext = context;
        mTitle=title;
        mOnSureClick=onClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.dialog_my_alert);
        dialog_content = (TextView) findViewById(R.id.dialog_content);
        dialog_content.setText(mTitle);
        tv_sure = (TextView) findViewById(R.id.tv_sure);
        tv_sure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
                mOnSureClick.onClick(view);
            }
        });
    }
}
